package com.enjoyor.soa.traffic.rest.efoms.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.enjoyor.soa.traffic.api.dto.efoms.WorkordersInfoDto;
import com.enjoyor.soa.traffic.frame.annotation.Auth;
import com.enjoyor.soa.traffic.frame.security.bean.dto.UserDto;
import com.enjoyor.soa.traffic.rest.efoms.dubbo.IFaultHourCollectConsumeService;
import com.enjoyor.soa.traffic.rest.efoms.dubbo.IPingConnectConsumeService;
import com.enjoyor.soa.traffic.rest.efoms.dubbo.IWorkordersInfoConsumeService;
import com.enjoyor.soa.traffic.util.pojo.Page;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Auth
@RestController
@RequestMapping({ "/fault" })
@Api("异常数据rest接口")
@CrossOrigin
public class FaultHourCollectController {
	@Autowired
	private IFaultHourCollectConsumeService faultHourCollectConsumeService;
	
	@GetMapping(value = { "getFaultHourCollectList" }, produces = { "application/json; charset=UTF-8" })
	@ResponseBody
	@ApiOperation("查询设备异常数据")
	@ApiImplicitParams({ 
		@ApiImplicitParam(name = "devCategoryCode", value = "设备种类编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devTypeCode", value = "设备类型编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "collectStartTime", value = "统计开始时间", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "collectEndTime", value = "统计结束时间", paramType = "query", dataType = "String")})
	public ResultPojo getFaultHourCollectList(
			@RequestParam(defaultValue = "", value = "devCategoryCode", required = false) String devCategoryCode,
			@RequestParam(defaultValue = "", value = "devTypeCode", required = false) String devTypeCode,
			@RequestParam(defaultValue = "", value = "collectStartTime", required = false) String collectStartTime,
			@RequestParam(defaultValue = "", value = "collectEndTime", required = false) String collectEndTime,
			HttpServletRequest request) {
		return faultHourCollectConsumeService.selectFaultHourCollectList(devCategoryCode, devTypeCode,
				collectStartTime, collectEndTime);
	}
	
	@GetMapping(value = { "getFaultRealCollectList" }, produces = { "application/json; charset=UTF-8" })
	@ResponseBody
	@ApiOperation("统计当前时间实时异常数")
	@ApiImplicitParams({ 
		@ApiImplicitParam(name = "devCategoryCode", value = "设备种类编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devTypeCode", value = "设备类型编号", paramType = "query", dataType = "String")})
	public ResultPojo getFaultRealCollectList(
			@RequestParam(defaultValue = "", value = "devCategoryCode", required = false) String devCategoryCode,
			@RequestParam(defaultValue = "", value = "devTypeCode", required = false) String devTypeCode,
			HttpServletRequest request) {
		return faultHourCollectConsumeService.selectFaultRealCollectList(devCategoryCode, devTypeCode);
	}
}
